<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //缺点：所有实例共享父类的属性，互相影响 而且无法传参

        function father() {
            this.username = 'zhangquan';
            this.arr = [0, 1, 2];
        }

        function child() {
            this.age = '18';
        }
        child.prototype = new father();
        let child1 = new child();
        let child2 = new child();
        child1.arr[0] = 4;
        console.log(child1.arr);
        console.log(child2.arr);
    </script>
</body>

</html>